package com.cloud.lawcase.api.web;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.cloud.lawcase.api.bean.LawCauseEditBean;
import com.cloud.lawcase.api.bean.LawCriteriaBean;
import com.cloud.lawcase.api.service.LawCauseEditService;
import com.cloud.lawcase.common.result.Quokka;

import springfox.documentation.annotations.ApiIgnore;

@ApiIgnore
@RestController
@RequestMapping("lawcase/api/edit")
public class LawCauseEditController {

	@Autowired
	private LawCauseEditService lawCauseEditService;

	@RequestMapping("listtree")
	public Quokka listTree(long id, int excuteTypeId) {
		return new Quokka(true, lawCauseEditService.listTree(id, excuteTypeId));
	}

	@RequestMapping("liststatpage")
	public Quokka listStatPage(@RequestBody LawCriteriaBean criteria) {
		return new Quokka(true, lawCauseEditService.listStatPage(criteria));
	}

	@RequestMapping("listitemcause")
	public Quokka listItemCause(long id, int excuteTypeId) {
		return new Quokka(true, lawCauseEditService.listItemCause(id, excuteTypeId));
	}

	@RequestMapping("create")
	public Quokka createLawCause(@RequestBody LawCauseEditBean lawCause) {
		return new Quokka(true, lawCauseEditService.createLawCause(lawCause));
	}

	@RequestMapping("update")
	public Quokka updateLawCause(@RequestBody LawCauseEditBean lawCause) {
		return new Quokka(true, lawCauseEditService.updateLawCause(lawCause));
	}

	@RequestMapping("delete")
	public Quokka deleteLawCause(long id) {
		lawCauseEditService.deleteLawCause(id);
		return new Quokka(true, id);
	}

	@GetMapping("copy")
	public Quokka copyLawCause(long srcId, long targetId) {
		return new Quokka(true, lawCauseEditService.copyLawCause(srcId, targetId));
	}
}
